#------------------------------------------------------------------------------
# definiendo fuentes para la libreria
#------------------------------------------------------------------------------
FILE(GLOB_RECURSE vfs_headers "src/*.h")
FILE(GLOB_RECURSE vfs_sources "*src/*.cpp")


IF(${CMAKE_BUILD_TYPE} MATCHES "Debug" )
	SET(THIRD_PARTY_LIBS "${PROJECT_BINARY_DIR}/${THIRD_PARTY_LIB_DIR}/debug")
ELSEIF(${CMAKE_BUILD_TYPE} MATCHES "Release" )
	SET(THIRD_PARTY_LIBS "${PROJECT_BINARY_DIR}/${THIRD_PARTY_LIB_DIR}/release")
ENDIF()

#SET(ENGINE_LIBS ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libcore.a ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/liblog.a)
#------------------------------------------------------------------------------
# Generando libreria "vfs"
#------------------------------------------------------------------------------
message("Generating library vfs")
ADD_LIBRARY(vfs STATIC ${vfs_sources} ${vfs_headers})

#------------------------------------------------------------------------------
# definiendo fuentes para el ejecutable de tests
#------------------------------------------------------------------------------
FILE(GLOB_RECURSE test_vfs_headers "test/*.h")
FILE(GLOB_RECURSE test_vfs_sources "test/*.cpp")

#------------------------------------------------------------------------------
# Atencion al orden en el que se insertan las librerias.
#------------------------------------------------------------------------------
FILE(GLOB_RECURSE test_vfs_headers "test/*.h")
SET(TEST_LIBS 
	gtest_main 
	gtest 
	pthread 
	vfs 
	physfs 
	core 
	log 
        utils
	"${BOOST_DIR}/stage/lib/libboost_system.a" 
	"${BOOST_DIR}/stage/lib/libboost_filesystem.a"
	)

INCLUDE_DIRECTORIES(
	"${PROJECT_BINARY_DIR}/${THIRD_PARTY_INC_DIR}"
	"${PROJECT_SOURCE_DIR}/modules/core/src"
	"${PROJECT_SOURCE_DIR}/modules/Log/src"
        "${PROJECT_SOURCE_DIR}/modules/utils/src"
	"${PROJECT_SOURCE_DIR}/modules/vfs/src"
)

#------------------------------------------------------------------------------
# Generando ejecutable de test unitarios
#------------------------------------------------------------------------------
ADD_EXECUTABLE(vfs_test ${test_vfs_sources} ${test_vfs_headers})
TARGET_LINK_LIBRARIES(vfs_test ${TEST_LIBS})

#------------------------------------------------------------------------------
# Ejecutando test cases
#------------------------------------------------------------------------------
enable_testing()
IF(ZEL_EXECUTE_TESTS)
	add_test(NAME testing_vfs 
				COMMAND vfs_test)
ENDIF()
